﻿using SqlSugar;
using System.ComponentModel.DataAnnotations;

namespace Koala.Pro.Core.Models;

[SugarTable("T_ACL_User")]
public class UserInfo : Entity
{
    public const int IdentityLen = 50;

    public const string DefaultPassword = "12345678";

    [SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
    public override int Id { get; set; }

    public virtual int? PID { get; set; }

    public virtual string HandNo { get; set; }

    [Required]
    public virtual string Name { get; set; }

    [Required]
    public virtual string Password { get; set; }

    public virtual string FullName { get; set; }

    public virtual string Nickname { get; set; }

    public virtual bool IsExpire { get; set; }

    public virtual DateTime? ExpireDate { get; set; }

    public virtual string Title { get; set; }

    public virtual string IdentityCard { get; set; }

    public virtual string MobilePhone { get; set; }

    public virtual string OfficePhone { get; set; }

    public virtual string HomePhone { get; set; }

    public virtual string Email { get; set; }

    public virtual string Address { get; set; }

    public virtual string WorkAddr { get; set; }

    public virtual string Gender { get; set; }

    public virtual DateTime? Birthday { get; set; }

    public virtual string QQ { get; set; }

    public virtual string Signature { get; set; }

    public virtual string AuditStatus { get; set; }

    public virtual string Note { get; set; }

    public virtual string CustomField { get; set; }

    public virtual string Dept_ID { get; set; }

    public virtual string DeptName { get; set; }

    public virtual string Company_ID { get; set; }

    public virtual string CompanyName { get; set; }

    public virtual string SortCode { get; set; }

    public virtual string Creator { get; set; }

    public virtual string Creator_ID { get; set; }

    public virtual DateTime? CreateTime { get; set; }

    public virtual string Editor { get; set; }

    public virtual string Editor_ID { get; set; }

    public virtual DateTime? EditTime { get; set; }

    public virtual int? Deleted { get; set; } = 0;


    public virtual string Question { get; set; }

    public virtual string Answer { get; set; }

    public virtual string LastLoginIP { get; set; }

    public virtual DateTime? LastLoginTime { get; set; }

    public virtual string LastMacAddress { get; set; }

    public virtual string CurrentLoginIP { get; set; }

    public virtual DateTime? CurrentLoginTime { get; set; }

    public virtual string CurrentMacAddress { get; set; }

    public virtual DateTime? LastPasswordTime { get; set; }

    public virtual string OpenId { get; set; }

    public virtual string UnionId { get; set; }

    public virtual string Status { get; set; }

    public virtual string SubscribeWechat { get; set; }

    public virtual string DeptPermission { get; set; }

    public virtual string CorpUserId { get; set; }

    public virtual string CorpStatus { get; set; }

    public virtual string AvatarUrl { get; set; }

    [SugarColumn(IsIgnore = true)]
    public List<string> RoleNames { get; set; }

    [SugarColumn(IsIgnore = true)]
    public List<RoleInfo> Roles { get; set; }

    [SugarColumn(IsIgnore = true)]
    public bool IsSuperAdmin { get; set; }

    [SugarColumn(IsIgnore = true)]
    public bool IsAdmin { get; set; }

    [SugarColumn(IsIgnore = true)]
    public List<string> OuNames { get; set; }

    public UserInfo()
    {
        PID = -1;
        CreateTime = DateTime.Now;
        EditTime = DateTime.Now;
        Status = "未关联";
        SubscribeWechat = "未关注";
    }
}
